/*
	@title: 图片缩放插件
	@author: likaituan
	@date: 2011.8.1
*/

function zoomImg(obj){
	var img = F(obj).css("width:100%; height:100%;"),
		sbox = img.parent().hover(function(e){
			mirror.show() && bigimg.src(img.attr('bigimg')) && ibox.show();
		},function(e){
			mirror.hide() && ibox.hide();
		}).bind("mousemove", function(e){
			var x = F.limit(e.clientX-p.x-sw/2,0,sw);
			var y = F.limit(e.clientY-p.y-sh/2,0,sh);
			mirror.pos(x,y);
			ibox.scrollLeft(x/sw*iw).scrollTop(y/sh*ih);
		}),
		p = sbox.abspos(1),
		sw = sbox.width()/2,
		sh = sbox.height()/2,
		mirror = sbox.append("div").bg("#fede4f").border("#aaa").cursor("move").opacity(0.5).rect(0,sh,sw,sh,1).hide();	
		ibox = sbox.parent().append("div").cls("big_box").hide();
		iw = ibox.width(),
		ih = ibox.height(),
		bigimg = ibox.append("img").css("width:200%; height:200%;");
}